<script>
	export default{
		// 提供数据
		data(){
			return {
				name: '卢高雅',
				color: 'color:red;',
				books: [
					
				]
			}
		},
		template: {
			
		},
		methods: {
			changePerson(){
				this.name = '张三'
			},
			
			changeColor() {
				this.color = "color:green;"
			}
		},
		render: {
			
		},
		computed: {
			hasBook(){
				return this.books.length > 0 ? '有':'没有'
			}
		},
		watch: {
			name(newValue, oldValue){
				console.log(newValue)
				console.log(oldValue)
			}
		}
	}
</script>

<!--模板语法-->
<template>
	<h1 :style="color">{{name}}</h1>
	<button @click="changePerson()">点击换人</button>
	<button @click="changeColor()">点击换色</button>
	<h1>今天暴富了吗</h1>
	<h1>{{hasBook}}</h1>
	
	
</template>

<style>
</style>